<?php
	namespace Admin\Controller;
	use Think\Controller;
	class LoginController extends Controller{
		   public function index(){
		    	$this->display();
		    }
		    //处理登录
		    public function dologin(){
		    	//判断是否为空
		    	//接收数据
		    	$data['name'] = $_POST['name'];
		    	$data['poss']  = md5($_POST['poss']);

		    	//M
		    	$model = D('AdminUser');
		    	$res =$model->getFind($data);
		    	if($res){
		    		//登录成功
		    		$_SESSION['admin_user']=$res;
		    		//跳转到首页
		    		$this->success('登录成功',U('Index/index'),2);

		    	}else{
		    		$this->error('登录错误',U('Login/index'));
		    	}
		    }

		    public function Loginout(){
		    	unset($_SESSION['admin_user']);
		    	$this->redirect('Login/index');

		    }
	}